/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities.pos;

import com.giant.entities.PaymentType;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author david
 */
@Entity
@Table(name = "p_invoice_payment")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PInvoicePayment.findAll", query = "SELECT p FROM PInvoicePayment p"),
    @NamedQuery(name = "PInvoicePayment.findByIdInvoicePayment", query = "SELECT p FROM PInvoicePayment p WHERE p.idInvoicePayment = :idInvoicePayment"),
    @NamedQuery(name = "PInvoicePayment.findByValue", query = "SELECT p FROM PInvoicePayment p WHERE p.value = :value"),
    @NamedQuery(name = "PInvoicePayment.findByNumDoc", query = "SELECT p FROM PInvoicePayment p WHERE p.numDoc = :numDoc"),
    @NamedQuery(name = "PInvoicePayment.findByDateDoc", query = "SELECT p FROM PInvoicePayment p WHERE p.dateDoc = :dateDoc"),
    @NamedQuery(name = "PInvoicePayment.findByObservations", query = "SELECT p FROM PInvoicePayment p WHERE p.observations = :observations")})
public class PInvoicePayment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_invoice_payment")
    private Integer idInvoicePayment;
    @Basic(optional = false)
    @NotNull
    @Column(name = "value")
    private float value;
    @Size(max = 50)
    @Column(name = "num_doc")
    private String numDoc;
    @Column(name = "date_doc")
    @Temporal(TemporalType.DATE)
    private Date dateDoc;
    @Size(max = 500)
    @Column(name = "observations")
    private String observations;
    @JoinColumn(name = "id_payment_type", referencedColumnName = "id_payment_type")
    @ManyToOne(optional = false)
    private PaymentType idPaymentType;
    @JoinColumn(name = "id_invoice", referencedColumnName = "id_invoice")
    @ManyToOne(optional = false)
    private PInvoice idInvoice;

    public PInvoicePayment() {
    }

    public PInvoicePayment(Integer idInvoicePayment) {
        this.idInvoicePayment = idInvoicePayment;
    }

    public PInvoicePayment(Integer idInvoicePayment, float value) {
        this.idInvoicePayment = idInvoicePayment;
        this.value = value;
    }

    public Integer getIdInvoicePayment() {
        return idInvoicePayment;
    }

    public void setIdInvoicePayment(Integer idInvoicePayment) {
        this.idInvoicePayment = idInvoicePayment;
    }

    public float getValue() {
        return value;
    }

    public void setValue(float value) {
        this.value = value;
    }

    public String getNumDoc() {
        return numDoc;
    }

    public void setNumDoc(String numDoc) {
        this.numDoc = numDoc;
    }

    public Date getDateDoc() {
        return dateDoc;
    }

    public void setDateDoc(Date dateDoc) {
        this.dateDoc = dateDoc;
    }

    public String getObservations() {
        return observations;
    }

    public void setObservations(String observations) {
        this.observations = observations;
    }

    public PaymentType getIdPaymentType() {
        return idPaymentType;
    }

    public void setIdPaymentType(PaymentType idPaymentType) {
        this.idPaymentType = idPaymentType;
    }

    public PInvoice getIdInvoice() {
        return idInvoice;
    }

    public void setIdInvoice(PInvoice idInvoice) {
        this.idInvoice = idInvoice;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idInvoicePayment != null ? idInvoicePayment.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PInvoicePayment)) {
            return false;
        }
        PInvoicePayment other = (PInvoicePayment) object;
        if ((this.idInvoicePayment == null && other.idInvoicePayment != null) || (this.idInvoicePayment != null && !this.idInvoicePayment.equals(other.idInvoicePayment))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.PInvoicePayment[ idInvoicePayment=" + idInvoicePayment + " ]";
    }
    
}
